package com.zhouheng.springbootmultithreading.tuling.threadbase;

import java.util.concurrent.locks.LockSupport;

import lombok.extern.slf4j.Slf4j;

/**
 * @author Fox
 */
@Slf4j
public class ThreadStateTest {

    public static void main(String[] args) throws InterruptedException {
//        Thread thread = new Thread();
        Thread thread = new Thread(new Runnable() {
            @Override
            public void run() {
                LockSupport.park();
            }
        });
        log.debug("线程状态：{}", thread.getState());
        thread.start();
        log.debug("线程状态：{}", thread.getState());
        Thread.sleep(100);
        // 如果线程中没有run任务，则这里为直接结束为TERMINATED状态；
        // 如果有任务执行中，设置为LockSupport.park则为WAITING状态
        log.debug("线程状态：{}", thread.getState());
    }

}
